using System;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using UwinEducation.Shared.Converters;
using UwinEducation.Shared.Enums;
namespace UwinEducation.Application.Dtos
{


    /// <summary>
    /// 教师档期DTO
    /// </summary>
    public class TeacherAvailabilityDto
    {
        /// <summary>
        /// 档期ID
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 教师ID
        /// </summary>
        public Guid TeacherId { get; set; }

        /// <summary>
        /// 教师姓名
        /// </summary>
        public string TeacherName { get; set; }

        /// <summary>
        /// 开始日期
        /// </summary>
        public DateTime StartDate { get; set; }

        /// <summary>
        /// 结束日期
        /// </summary>
        public DateTime EndDate { get; set; }

        // /// <summary>
        // /// 星期几 (1-7, 1代表星期一)
        // /// </summary>
        // public int DayOfWeek { get; set; }

        // /// <summary>
        // /// 开始时间 (HH:mm)
        // /// </summary>
        // public TimeSpan StartTime { get; set; }

        // /// <summary>
        // /// 结束时间 (HH:mm)
        // /// </summary>
        // public TimeSpan EndTime { get; set; }

        /// <summary>
        /// 课程类型
        /// </summary>
        public CourseType? CourseType { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remarks { get; set; }

        /// <summary>
        /// 教师
        /// </summary>
        public TeacherDto Teacher { get; set; }

        ///// <summary>
        ///// 创建时间
        ///// </summary>
        //public DateTime CreatedAt { get; set; }
    }
    /// <summary>
    /// 创建教师档期DTO
    /// </summary>
    public class CreateTeacherAvailabilityDto
    {
        ///// <summary>
        ///// 教师ID
        ///// </summary>
        //[Required(ErrorMessage = "教师ID不能为空")]
        //public Guid TeacherId { get; set; }

        /// <summary>
        /// 开始日期
        /// </summary>
        [Required(ErrorMessage = "开始日期不能为空")]
        [JsonConverter(typeof(CustomDateTimeConverter))]
        public DateTime StartDate { get; set; }

        /// <summary>
        /// 结束日期
        /// </summary>
        [Required(ErrorMessage = "结束日期不能为空")]
        [JsonConverter(typeof(CustomDateTimeConverter))]
        public DateTime EndDate { get; set; }

        /// <summary>
        /// 星期几 (1-7, 1代表星期一)
        /// </summary>
        // [Required(ErrorMessage = "星期几不能为空")]
        // [Range(0, 6, ErrorMessage = "星期几必须在0-6之间")]
        // public int DayOfWeek { get; set; }

        // /// <summary>
        // /// 开始时间 (HH:mm)
        // /// </summary>
        // [Required(ErrorMessage = "开始时间不能为空")]
        // public TimeSpan StartTime { get; set; }

        // /// <summary>
        // /// 结束时间 (HH:mm)
        // /// </summary>
        // [Required(ErrorMessage = "结束时间不能为空")]
        // public TimeSpan EndTime { get; set; }

        /// <summary>
        /// 课程类型
        /// </summary>
        public CourseType? CourseType { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remarks { get; set; }
    }

    public class BatchCreateTeacherAvailabilityDto
    {
        /// <summary>
        /// 教师ID
        /// </summary>
        [Required(ErrorMessage = "教师ID不能为空")]
        public Guid TeacherId { get; set; }

        /// <summary>
        /// 教师档期日期集合
        /// </summary>   
        public List<CreateTeacherAvailabilityDto>? Availabilities { get; set; }
    }

    /// <summary>
    /// 更新教师档期DTO
    /// </summary>
    public class UpdateTeacherAvailabilityDto
    {
        /// <summary>
        /// 档期ID
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 开始日期
        /// </summary>
        public DateTime? StartDate { get; set; }

        /// <summary>
        /// 结束日期
        /// </summary>
        public DateTime? EndDate { get; set; }

        /// <summary>
        /// 星期几 (0-6, 0代表星期日)
        /// </summary>
        [Range(0, 6, ErrorMessage = "星期几必须在0-6之间")]
        public int? DayOfWeek { get; set; }

        /// <summary>
        /// 开始时间 (HH:mm)
        /// </summary>
        public TimeSpan? StartTime { get; set; }

        /// <summary>
        /// 结束时间 (HH:mm)
        /// </summary>
        public TimeSpan? EndTime { get; set; }

        /// <summary>
        /// 课程类型
        /// </summary>
        public CourseType? CourseType { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remarks { get; set; }
    }
    /// <summary>
    /// 获取教师档期请求参数
    /// </summary>
    public class GetTeacherAvailabilityByDateRangeRequest
    {
        /// <summary>
        /// 教师ID
        /// </summary>
        public Guid TeacherId { get; set; }

        /// <summary>
        /// 开始日期
        /// </summary>
        public DateTime StartDate { get; set; }

        /// <summary>
        /// 结束日期
        /// </summary>
        public DateTime EndDate { get; set; }
    }
} 